var gulp=require("gulp");
var gulp_minify_css=require("gulp-minify-css");
var gulp_sass=require("gulp-sass");
var gulp_uglify=require("gulp-uglify");
//var browserSync = require('browser-sync').create();



//定义自动刷新浏览器任务
//gulp.task("bs",function(){
//	browserSync.init({
//		server:{
//			baseDir:"./"
//		},
//		//修改端口号
//		port:4000
//	})
//	gulp.watch("src/scss/**/*.scss" ,["sass"])
//		.on("change",browserSync.reload)
//});

//编译sass
gulp.task("sass",function(){
	gulp.src("src/scss/**/*.scss")
	.pipe(gulp_sass())
	.pipe(gulp.dest("dist/css"))
})
//压缩css
gulp.task("minifycss",function(){
	gulp.src("src/css/**/*.css")
		.pipe(gulp_minify_css())
		.pipe(gulp.dest("dist/css"));
})
//压缩js
gulp.task("uglify",function(){
	gulp.src("src/js/**/*.js")
		.pipe(gulp_uglify())
		.pipe(gulp.dest("dist/js"));
})

//复制html
gulp.task("copyhtml",function(){
	gulp.src("src/**/*.html")
		.pipe(gulp.dest("dist/"))
	
})

//一键压缩css,js,HTML
gulp.task("pro",["copyhtml","minifycss","uglify"])



